package net.zjitc.common.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016082700321199";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCGv/u0tFsCe8TTW+Lr+1T3uvEwt5L6DEFo5FG6c9mjucX2e1P91jc03leVqjl0CyOroH2oDERTOid33W4BUYQuFQRU3PfCc40k71O/gxNpw3/oyO2WOzEgeCPEVuQPhk/dTuX1aRbqDrN1aVF6dzlMTzOedBme/yQDoO86znLwQIVcXNah3Lgg5TJ8yz2H7+L4zAYlSNd3fp+eUZwnEoEq3/auMrpbjeB7eQPCk8Dpe3nIMSMFHigRgI4zxVPP0EUvIssT4ETrDrcMvemCvwq6rHoqzWclawxlVzAgFSNr/XqPn20J8CIS4icAgE1gjFv10ex/u3sI2LIDMbTUgtPtAgMBAAECggEASw2tzgXS1zxG8g6xAw2XUvB+HMtzAvFGkXzyhK64X3g+6j3hF3Z0g28AS61nmNoHgTXAJ5TFjbHLf/kGp5dWzzAHnJkDKvyfdh4TgI0qh/NLUEZyBwZrI5GnIlnfZ0JBQ5wJe7qP98g+brw9lL/JW1aWAsDZ8HReA+NkvFV3MZd/fTukpsgaZ4m3xjw9+ef3pAefU/DXt/gk08oCBpCnKEsOKmn6tXSpgxHGfREUetwg93g2zRXYIeyY2f4WtWRKv3EYivQA4wwcTOy4yZd2kfcL+t3orgHg1fq7W5B/vfArLKKEbG1DJqgAtOTC1BkvtMas0KACLel8IvpOTpFzAQKBgQC9ziqHHbp6/5nZdwmeb3uJBb+0nkldUN5Lyze94m+F0ADrq00PXO1t/NYP/X7nHgNe7Uxn2KrYl+FthxPTQMxItVxGBUX3lOJhbAjKUON87UQeQMiomTjYS9x73ns5uArshmRUBRA7Cm8q8YJJKWOk7naLkvdYh0f7pgVzpxFTLQKBgQC1vneH63Id8C46IUhgi2EBXd7COzS5IUpOUBGr02JNQSx29DmEFvzcAIDmTHrU7ZkGlTsaVSSfJx02C+PRALglNbM/b/uuL/5nMgTtGta8GZnUejHwqDBGqEFnkNDA3MkXq4J4SSKyyvbLL1HIfFYcvYUm0az6lLo8mVB2Gz77wQKBgGoQIPesBx7gYgqBWGCuj2u8SKoXoYuBuxbDknyLYiJ2X21SJhelqA/EL6Jz10wzG1Maa43EJ4QtKw1XZB6yoPUoU03VeImnKvGhuy/DD7wpodz9+qMsK/XCPo0Bf/5696/AUaQZyD4V0JVAq7tSY5ownxHTqGBSCEl5Nqav/yBpAoGAKsA67cX8ef5dYV8i31Lp5qBmHdo/dKzYBcPf5EM9BF8oTnL0dJXTtQyJRaMH4b5iGKJR3MfabXWN8YCqfidlKZuQJoP49+hiN3QUpJGDoYuEG+8CgFGPyY8ak3oFINjOlLrLXfAWMWh81R60ZiyZNPl/sLnxrp/9jvOhcabHEgECgYEAmqaGxBBS6eBEAYsjaqJx+19hdNYm1pdlFmFl3EXvl3OcTkR0O9kJfnsTO5kXjpE61OzEAK2p0IYW346dXHw9Z6UKVNlwtu7VRHRgODOzWrVrI0vkAsyzLSqFR0+pfprusIBxU3HhIl9EdazFPYtQWkc7Co+BFItMiA5+XEZVgLk=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzW3ymNy31WIlHDe+cyOtAeyGdHk93QBqWeAKCvBljXkvs9g/oMhCphcatjrjLX8Cpwh0bXCRxpunpqCgahVbHj1qsofyXABBjye1Q8LFARmJGwLKccN3879cL9GCFG3TBi3h/tAg5XZoJhvQIE5f1mi5art3FB07oDhHDxAypZq6hC11LFvYkqSfKKTr3eiqonLDgvKjwRYvMP4umRNP+4k+OZNNw57I1Os3VxJqzRWgVm5S2lQ7yOxXE6o0tlJ3dbG6ljIuZbfiUdz7Gq0Po6zGWvEW/BlRIxfxmhB1bjVAq3ymW4ecWuE1w/4im1gq/aA/Fo1n73LOi0Gu7FrrAQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8085/shop/notify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/order/payReturn.do";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关  https://openapi.alipaydev.com/gateway.do
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
